home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-06 / mmenu136.zip / INST.MNU < prev    next >
Text File  |  1992-01-04  |  12KB  |  418 lines

  1. Comment
  2. =========================================================
  3.  
  4. MarxMenu installation Menu:
  5.  
  6. Copyright 1989-1992 by Marc Perkel * All rights reserved.
  7.  
  8. This is an example of how MarxMenu can be used as a job control
  9. language. There is quite an education in MarxMenu tricks here. If
  10. you want to write a similar program, this menu is worth studying.
  11.  
  12. =========================================================
  13. EndComment
  14.  
  15. Var
  16.   EchoSt
  17.   FileLine
  18.   FileLinePtr
  19.   ProgName
  20.   BatExit
  21.   EchoTail
  22.   ConfigSysPath
  23.   ConfigSysLines
  24.   WorkStr
  25.   DosVerNumber
  26.  
  27. Const
  28.   PauseTime = 100
  29.  
  30. DelFile 'MENUS.EXE'
  31.  
  32. InitialDisplay
  33.  
  34. Shadow Off
  35. DrawBox 25 11 31 7
  36.  
  37. DosVerNumber = DosVersion * 100 + MinorDosVersion
  38.  
  39. ;MXECHO is a debugging environment variable. Use SET MXMENU=OFF for
  40. ;normal use. SET MXECHO=ON to watch the MARX.BAT run.
  41.  
  42. If ReadEnv('MXECHO') > ''
  43.    EchoTail = '%MXECHO%'
  44. Else
  45.    EchoTail = 'OFF'
  46. EndIf
  47.  
  48. if DosVerNumber >= 330
  49.    EchoSt = '@ECHO ' + EchoTail
  50. else
  51.    EchoSt = 'ECHO ' + EchoTail
  52. endif
  53.  
  54.  
  55. ProgName = CleanFileName(Path + '\MARXMENU.EXE')
  56.  
  57. Write ' Creating MARX.BAT ... '
  58.  
  59. ;----- BatExit is a 0k bat file used to exit batch files
  60.  
  61. FileAssign (BatExit,'BATEXIT.BAT')
  62. FileCreate BatExit
  63. FileClose  BatExit
  64.  
  65. ;----- Here we create the MARX.BAT file.
  66.  
  67. ClearLineBuffer
  68.  
  69. AddLine (EchoSt)
  70. AddLine (ProgName + ' %1 ')
  71. AddLine ('%MXCMD%')
  72. AddLine (CleanFileName(Path + '\MARX.BAT') + ' %1')
  73. AddLine ('')
  74. AddLine ('Goto ERROR1')
  75. AddLine ('')
  76. AddLine ('*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*')
  77. AddLine ('')
  78. AddLine ('MarxMenu * CopyRight 1989-92 by Marc Perkel')
  79. AddLine ('')
  80. AddLine ('If you are having trouble getting MarxMenu to work,')
  81. AddLine ('the first line of this file can be changed to ECHO ON.')
  82. AddLine ('')
  83. AddLine ('MarxMenu controls this batch file by writing to the environment')
  84. AddLine ('variable MXCMD.')
  85. AddLine ('')
  86. AddLine ('MXSTOP.BAT is executed to exit this batch file.')
  87. AddLine ('')
  88. AddLine ('*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*')
  89. AddLine ('')
  90. AddLine ('         MARX.BAT')
  91. AddLine ('         --------   +--MarxMenu Creates--+')
  92. AddLine ('  +----> @ECHO OFF  |                    |')
  93. AddLine ('  |      MARXMENU.EXE %1                 |')
  94. AddLine ('  |      %MXCMD% >--+                    +-> $MX00000.BAT')
  95. AddLine ('  | +--> MARX %1 +  |                        ------------')
  96. AddLine ('  | |            |  +----------------------> CD\WORDSTAR')
  97. AddLine ('  +-|------<-----+                           WS --+')
  98. AddLine ('    |                                             |')
  99. AddLine ('    +-------------------------------------------<-+')
  100. AddLine ('')
  101. AddLine ('Note: MarxMenu sets MXCMD = CALL $MX00000.BAT')
  102. AddLine ('')
  103. AddLine ('By Default, MarxMenu creates the temporary batch file in the same')
  104. AddLine ('directory as MARXMENU.EXE. If a second parameter is specified, and')
  105. AddLine ('the second parameter is a directory, then MarxMenu will create the')
  106. AddLine ('batch file there. If the second paramerer is a file name, then MarxMenu')
  107. AddLine ('will use it for the temporary file.')
  108. AddLine ('')
  109. AddLine ('If you set and environment variable TEMP to the name of a directory,')
  110. AddLine ("MarxMenu will use this directory for it's temporary batch files.")
  111. AddLine ('')
  112. AddLine ('Example SET TEMP=C:\TEMPFILE')
  113. AddLine ('')
  114. AddLine ('The MARX.BAT file must be path accessable or you will get a')
  115. AddLine ('"Bad Command or FileName" error. MARXMENU.EXE must also be path')
  116. AddLine ('accessable. The directory where MarxMenu creates temporary batch')
  117. AddLine ('files does not need to be path accessable.')
  118. AddLine ('')
  119. AddLine ('*-=-=-=-=-=-=-=-=-=-=[ Error Trapping Section ]-=-=-=-=-=-=-=-=-*')
  120. AddLine ('')
  121. AddLine ('If you get here it is probably because you moved the MARX.BAT file')
  122. AddLine ("from the directory you installed it to a new directory and didn't")
  123. AddLine ('change the path to MARXMENU.EXE and MARX.BAT in lines 2 and 4 of')
  124. AddLine ('this batch file.')
  125. AddLine ('')
  126. AddLine (':ERROR1')
  127. AddLine ('CLS')
  128. AddLine ('Echo  * * * * * * Warning * * * * * * *')
  129. AddLine ('Echo.')
  130. AddLine ('Echo  Line 4 of this batch file does not point to the directory')
  131. AddLine ('Echo  where MARX.BAT is located. Change to the directory where')
  132. AddLine ('Echo  the MARXMENU files are located and type MARXMENU INST to')
  133. AddLine ('Echo  re-create the MARX.BAT file for that directory.')
  134. AddLine ('')
  135. AddLine ('Goto ENDBAT')
  136. AddLine ('')
  137. AddLine ('*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*')
  138. AddLine ('')
  139. AddLine ('This exit point is used if MXSTOP.BAT can not be found. It is')
  140. AddLine ('usually caused by moving the MarxMenu files from one directory')
  141. AddLine ('to another and not copying all the BAT files. MarxMenu sets the')
  142. AddLine ('environment variable MXCMD to GOTO E in order to get here.')
  143. AddLine ('')
  144. AddLine ('*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*')
  145. AddLine ('')
  146. AddLine (':E')
  147. AddLine ('CLS')
  148. AddLine ('Echo  * * * * * * Warning * * * * * * *')
  149. AddLine ('Echo.')
  150. AddLine ('Echo  The file MXSTOP.BAT, DROPTO.BAT, and BATEXIT.BAT should be in')
  151. AddLine ('Echo  the same directory as the MARX.BAT file. Run MARXMENU INST in')
  152. AddLine ('Echo  the directory where you want MARX.BAT to reside.')
  153. AddLine (':ENDBAT')
  154.  
  155.  
  156. WriteTextFile 'MARX.BAT' FileLine
  157.  
  158. ClearLineBuffer
  159.  
  160. ;----- Here we create the DROPTO.BAT file.
  161.  
  162. Writeln
  163. Write ' Creating DROPTO.BAT ... '
  164.  
  165. AddLine ('DEL %1')
  166. AddLine ('SET KSV=')
  167. AddLine ('SET MXCMD=')
  168. AddLine ('%2 %3 %4 %5 %6 %7 %8 %9')
  169. AddLine ('BATEXIT')
  170. AddLine ('')
  171. AddLine ('*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*')
  172. AddLine ('')
  173. AddLine ('DropTo is used when you want to eliminate the temporary batch')
  174. AddLine ('file created by MarxMenu. This is useful if you shell to DOS')
  175. AddLine ('and then run MarxMenu from the dos shell. It avoids the')
  176. AddLine ('"Missing Batch File" error.')
  177. AddLine ('')
  178. AddLine ('DropTo is run from within the temporary batch file you want')
  179. AddLine ('to eliminate.')
  180. AddLine ('')
  181. AddLine ('Usage: DROPTO %0 <command line>')
  182. AddLine ('')
  183. AddLine ("Here's how it works:")
  184. AddLine ('')
  185. AddLine ('     $MX00000.BAT <------deletes this file--------+')
  186. AddLine ('     ------------                                 |')
  187. AddLine ('     DROPTO %0 COMMAND.COM ------------> DEL %1 >-+')
  188. AddLine ('                                         SET KSV=')
  189. AddLine ('                                         SET MXCMD=')
  190. AddLine ('              %2 executes command.com--> %2 %3 %4 %5 %6 %7 %8 %9')
  191. AddLine ('')
  192. AddLine ('*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*')
  193.  
  194. WriteTextFile 'DROPTO.BAT' FileLine
  195.  
  196. ClearLineBuffer
  197.  
  198. ;----- Here we create the MXSTOP.BAT file.
  199.  
  200. Writeln
  201. Write ' Creating MXSTOP.BAT ... '
  202.  
  203. AddLine ('SET MXCMD=')
  204. AddLine ('SET KSV=')
  205. AddLine ('REM From here, you control the menu exit process!')
  206.  
  207. WriteTextFile 'MXSTOP.BAT' FileLine
  208.  
  209. ClearLineBuffer
  210.  
  211. ;----- Here we create the GOFILE.BAT file.
  212.  
  213. Writeln
  214. Write ' Creating GOFILE.BAT ... '
  215.  
  216. AddLine (EchoSt)
  217. AddLine ('MARXMENU GOFILE %1')
  218. AddLine ('REM This batch file is used only with the GOFILE menu.')
  219.  
  220. WriteTextFile 'GOFILE.BAT' FileLine
  221.  
  222. ClearLineBuffer
  223.  
  224. Writeln
  225. Wait PauseTime
  226. EraseTopWindow
  227.  
  228. CheckEnvSize
  229.  
  230. EraseTopWindow
  231. BoxBorderColor Yellow Mag
  232. BoxInsideColor White Mag
  233. DrawBox 18 10 44 7
  234. BoxBorderColor LGreen Blue
  235. BoxInsideColor Yellow Blue
  236. DrawBox 23 12 34 3
  237. WriteCenter 'MarxMenu Installed!'
  238. Wait PauseTime * 2
  239. EraseTopWindow
  240. EraseTopWindow
  241.  
  242. BoxBorderColor LCyan Blue
  243. BoxInsideColor White Blue
  244. DrawBox 14 9 52 11
  245. WriteCenter '* Warning! *'
  246. Writeln
  247. Writeln
  248. Writeln '  One common mistake that users make is running'
  249. Writeln '  MARXMENU <menu>. You are supposed to run menus'
  250. Writeln '  by typing MARX <menu> which uses the MARX.BAT'
  251. Writeln '  file. Also, besides reading the manual, please'
  252. Writeln '  read the MARXREAD.ME file.'
  253. Writeln
  254. WriteCenter( ' * Press any Key to Continue * ' )
  255. Cursor Off
  256. LastKey = ReadKey
  257. EraseTopWindow
  258.  
  259. ExitMenu
  260.  
  261. ;--- Menu Exits Here
  262.  
  263. ;===================== Procedures ========================
  264.  
  265. ;--- Check the environment size
  266.  
  267. Procedure CheckEnvSize
  268. var NeededSpace ShellCommand OldComspec
  269.    if EnvFree < 150
  270.       OldComspec = ReadEnv('COMSPEC')
  271.       ConfigSysPath = ExistOnPath( 'CONFIG.SYS' )
  272.       NeededSpace = (EnvSize + 160) / 16 * 16
  273.       if DosVerNumber < 320
  274.          ShellCommand = Str(NeededSpace / 16)
  275.       else
  276.          ShellCommand = Str(NeededSpace)
  277.       endif
  278.       if ConfigSysPath = ''
  279.          BoxBorderColor LCyan Blue
  280.          BoxInsideColor White Blue
  281.          DrawBox 15 8 51 13
  282.          WriteCenter '* Warning! *'
  283.          Writeln char(7)
  284.          Writeln '  You have a total of ' EnvSize ' bytes of environment'
  285.          Writeln '  space with only ' EnvFree ' bytes free. MarxMenu'
  286.          Writeln '  requires about 150 bytes of free environment'
  287.          Writeln '  space. You should modify you CONFIG.SYS file'
  288.          Writeln '  as follows:'
  289.          Writeln
  290.          WriteCenter 'SHELL=COMMAND.COM /P /E:' ShellCommand
  291.          Writeln
  292.          Writeln
  293.          WriteCenter(' * Press any Key to Continue * ')
  294.          Cursor Off
  295.          LastKey = ReadKey
  296.          EraseTopWindow
  297.       else
  298.          ReadTextFile(ConfigSysPath,ConfigSysLines)
  299.          Loop(NumberOfElements(ConfigSysLines))
  300.            WorkStr = UpperCase(ConfigSysLines[LoopIndex])
  301.            If (NextWord( WorkStr) = 'SHELL')
  302.              Delete( ConfigSysLines,LoopIndex,1)
  303.            EndIf
  304.          EndLoop
  305.          ShellCommand = 'SHELL=' + OldComspec + ' /P /E:' + ShellCommand
  306.          ConfigSysLines[NumberOfElements(ConfigSysLines) + 1] = ShellCommand
  307.          WriteTextFile(ConfigSysPath,ConfigSysLines)
  308.       endIf
  309.    endIf
  310. EndProc
  311.  
  312.  
  313. Procedure AddLine (L)
  314.    FileLinePtr = FileLinePtr + 1
  315.    FileLine[FileLinePtr] = L
  316. EndProc
  317.  
  318.  
  319. Procedure ClearLineBuffer
  320.    Dispose(FileLine)
  321.    FileLinePtr = 0
  322. EndProc
  323.  
  324.  
  325. Procedure InitialDisplay
  326.    if ColorScreen
  327.       TextColor Cyan Blue
  328.       ClearScreen 176
  329.       GotoXY 1 25
  330.       TextColor Yellow Mag
  331.       ClearLine
  332.       WriteCenter 'MarxMenu Version ' MarxVersion ' * Copyright 1989-92 by Marc Perkel'
  333.       BoxBorderColor White Brown
  334.       BoxInsideColor Yellow Brown
  335.       BoxHeaderColor Yellow Mag
  336.       ClockColor Yellow Brown
  337.       TextColor Yellow Brown
  338.    else
  339.       ClearScreen 176
  340.       TextColor Black Grey
  341.       GotoXY 1 25
  342.       ClearLine
  343.       WriteCenter 'MarxMenu Version ' MarxVersion ' * Copyright 1989-92 by Marc Perkel'
  344.       BoxBorderColor Black Grey
  345.       BoxInsideColor Black Grey
  346.       BoxHeaderColor Black Grey
  347.       ClockColor Black Grey
  348.    endif
  349.  
  350.    SingleLineBox
  351.    Explode Off
  352.    DrawBox 1 1 80 3
  353.    GotoXY (54,1)
  354.    Write "MarxMenu Installation"
  355.    ClockPos 3 2
  356.  
  357.    BlankTime = 0
  358.    ScrollMove Off
  359.  
  360.    Explode On
  361.    Shadow Off
  362.    BlockBox
  363.    InverseColor Yellow Red
  364.  
  365.    BoxBorderColor Yellow Mag
  366.    BoxInsideColor Mag Mag
  367.    DrawBox 10 6 61 17
  368.    BoxBorderColor LGreen Blue
  369.    BoxInsideColor Yellow Blue
  370.    Shadow On
  371.  
  372.    DrawBox 35 13 11 3
  373.    WriteCenter 'The'
  374.    Loop 5
  375.       MoveWindow -4 -1
  376.       Wait 3
  377.    EndLoop
  378.  
  379.    DrawBox 35 13 11 3
  380.    WriteCenter 'Marx'
  381.    Loop 5
  382.       MoveWindow 4 -1
  383.       Wait 3
  384.    EndLoop
  385.  
  386.    DrawBox 35 13 11 3
  387.    WriteCenter 'Menu'
  388.    Loop 5
  389.       MoveWindow -4 1
  390.       Wait 3
  391.    EndLoop
  392.  
  393.    DrawBox 35 13 11 3
  394.    WriteCenter 'System'
  395.    Loop 5
  396.       MoveWindow 4 1
  397.       Wait 3
  398.    EndLoop
  399.  
  400.    Wait 20
  401.    DrawBox 25 13 31 3
  402.    WriteCenter 'Installation Menu'
  403.    Wait 250
  404.    RollWindow 4
  405.    EraseTopWindow
  406.    Wait 20
  407.    RollWindow 3
  408.    EraseTopWindow
  409.    Wait 20
  410.    RollWindow 2
  411.    EraseTopWindow
  412.    Wait 20
  413.    RollWindow 1
  414.    EraseTopWindow
  415.    Wait 20
  416.    EraseTopWindow
  417. EndProc
  418.